﻿@model CustomerBackInStockSubscriptionsModel
@using Nop.Web;
@using Nop.Web.Extensions;
@using SpotsHub.Gateway.Models.Customer;
@{    
    Layout = "~/Views/Shared/_Layout.cshtml";

    Html.AddTitleParts(T("PageTitle.BackInStockSubscriptions").Text);
}
@section left
{
    @Html.Partial("MyAccountNavigation", Model.NavigationModel, new ViewDataDictionary())
}
<div class="page account-page customer-info-page back-in-stock-subscription-list-page">
    <div class="window">
        
        <div class="window-title grad-lightgrey grad">
            <div class="window-title-bar grad-titleshine grad">
                <h2 class="page-title">@T("Account.MyAccount") - @T("Account.BackInStockSubscriptions")</h2>
            </div>
        </div>

        <div class="page-body account-info window-content space">

            @if (Model.Subscriptions.Count > 0)
            {
                <div class="description">
                    @T("Account.BackInStockSubscriptions.Description")
                </div>
                <script type="text/javascript">
                    $(document).ready(function () {

                        $('#selectall').click(function () {
                            $('.subscription-list .rowcheckbox').attr('checked', $(this).is(':checked')).change();
                        });

                        $('.subscription-list .rowcheckbox').live('change', function (e) {
                            var numChkBoxes = $('.subscription-list .rowcheckbox').length;
                            var numChkBoxesChecked = $('.subscription-list .rowcheckbox:checked').length;
                            $('#selectall').attr('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
                        });
                    });
                </script>        
                using (Html.BeginRouteForm("CustomerBackInStockSubscriptions", FormMethod.Post))
                {
                <div class="subscription-list">
                    <table class="data-table">
                        <thead>
                            <tr>
                                <th class="a-center">
                                    <input type="checkbox" id="selectall" />
                                </th>
                                <th class="a-center">
                                    @T("Account.BackInStockSubscriptions.ProductColumn")
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @for (int i = 0; i < Model.Subscriptions.Count; i++)
                            {
                                var item = Model.Subscriptions[i];
                                <tr @(i % 2 == 0 ? Html.Raw(" class=\"odd\"") : Html.Raw(" class=\"even\""))>
                                    <td class="a-center">
                                        <input type="checkbox" name="biss@(item.Id)" class="rowcheckbox" />
                                    </td>
                                    <td class="a-left">
                                        @Html.RouteLink(item.ProductName, "Product", new { SeName = item.SeName })
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                    @if (Model.PagerModel.TotalPages > 1)
                    {
                        <div class="biss-grid-pager-style">
                            @Html.Pager(Model.PagerModel)
                        </div>
                    }
                    <div class="clear">
                    </div>
                    <div class="buttons">
                        <input type="submit" value="@T("Account.BackInStockSubscriptions.DeleteSelected")" class="button-2 delete-selected-biss-button" />
                    </div>
                </div>
                }
            }
            else
            {
                <div class="no-data">
                    @T("Account.BackInStockSubscriptions.NoSubscriptions")
                </div>
            }
        </div>
    </div>
</div>
